<?php

namespace app\validate;

use share\validate\SceneValidate;

class SimBindDeviceValidate extends SceneValidate
{
    protected $rule = [
        'id' => 'require|integer',
        'iccid' => 'require|length:10,25',
        'bind' => 'require|integer|min:0|max:1',
        'factoryId' => 'length:0,20',
        'serialNo' => 'require',
    ];

    protected $sceneRules = [
        'set' => [
            'id' => 'require|integer',
            'iccid' => 'length:10,25',
            'net_type' => 'integer|min:0|max:3',
            'factory_id' => 'length:0,10',
            'status' => 'integer|min:0|max:2',
            'serial_no' => 'length:10,30',
        ],
        'importUpdateData' => [
            'iccid' => 'require|length:10,25',
            'net_type' => 'integer|min:1|max:3',
            'factory_id' => 'length:0,10',
            'serial_no' => 'length:10,30',
            'locked' => 'integer:|min:0|max:1',
            'lineNo' => 'require|integer',
        ],
    ];

    protected $scene = [
        'info' => ['iccid'],
        'bindUpdate' => ['iccid', 'bind', 'serialNo'],
        'makeRelation' => ['iccid', 'serialNo','factoryId'],
        'set' => ['id', 'iccid', 'net_type', 'factory_id', 'status', 'locked', 'serial_no'],
        'del' => ['id'],
        'importUpdateData' =>  ['iccid', 'net_type', 'factory_id', 'locked', 'serial_no'],
    ];
}
